package apigateway.project.commen.enums;

import io.netty.handler.codec.http.HttpResponseStatus;
import lombok.Getter;

@Getter
public enum ResponseCode {

    SUCCESS(HttpResponseStatus.OK, 0, "成功"),
    REQUEST_TIMEOUT(HttpResponseStatus.GATEWAY_TIMEOUT, 600, "连接下游服务超时"),
    INTERNAL_ERROR(HttpResponseStatus.INTERNAL_SERVER_ERROR, 1000, "网关内部错误"),
    HTTP_RESPONSE_ERROR(HttpResponseStatus.INTERNAL_SERVER_ERROR, 700, "服务返回异常"),
    SERVICE_INSTANCE_NOT_FOUND(HttpResponseStatus.NOT_FOUND,10005, "未找到对应的服务实例"),
    FLOW_CONTROL_ERROR(HttpResponseStatus.TOO_MANY_REQUESTS, 10040, "请求过量错误"),
    GATEWAY_FALLBACK(HttpResponseStatus.GATEWAY_TIMEOUT,10055, "请求超时，触发熔断降级");


    private HttpResponseStatus status;
    private int code;
    private String msg;

    private ResponseCode(HttpResponseStatus status, int code, String msg) {
        this.status = status;
        this.code = code;
        this.msg = msg;
    }
}
